package com.liuyang.concurrency.chapter2;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
//        TicketWindow ticketWindow1 = new TicketWindow("一号柜台");
//        ticketWindow1.start();
//
//        TicketWindow ticketWindow2 = new TicketWindow("二号柜台");
//        ticketWindow2.start();
//
//        TicketWindow ticketWindow3 = new TicketWindow("三号柜台");
//        ticketWindow3.start();
        Thread thread = new Thread(){
            @Override
            public void run() {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        thread.start();
        ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();

        Thread[] threads = new Thread[threadGroup.activeCount()];
        threadGroup.enumerate(threads);
        Arrays.asList(threads).forEach(System.out::println);

    }
}
